/*** 本文件由CSMIS2.0-ModelCreater(UTF-8)工具辅助生成，版本1.0 ***/

package com.ce.sys.cleanfile.logic.search;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.ce.framework.datamaintain.logic.ISQLMapper;
import com.ce.framework.datamaintain.logic.SQLSearchCondition;
import com.ce.framework.exception.AppException;
import com.ce.framework.util.StringUtil;
import com.ce.sys.cleanfile.view.SysFileCleanInfView;

/**
* 嫦娥软件有限公司 版权所有 2013
* 创建人：　andy
* 创建日期：2013-10-25
* 创建时间：14:52:22
* 功能描述：附件清理信息表 [SYS_T_FILE_CLEAN_INF]条件过滤类
* ==============================================
* 修改历史
* 修改人		修改时间		修改原因
*
* ==============================================
*/
public class SysFileCleanInfSearchCondition  extends SQLSearchCondition
	implements ISQLMapper
{

    private String tableName;
	public String getSearchSql() throws AppException {
		
		StringBuffer sql = new StringBuffer("select t.*,p.vc_name from SYS_T_FILE_CLEAN_INF t,SYS_T_PERSON P where t.vc_user = p.vc_id(+) and t.VC_DEL$FLAG = 0");
		if(StringUtil.isNotBlank(this.tableName)){
		    sql.append(" and t.VC_TABLE_NAME like '%"+tableName+"%'");
		}
		//排序
		if(StringUtil.isNotBlank(this.order)){
            sql.append(" order by "+ this.getOrderBy());
		}else{
			sql.append(" order by t.VC_TABLE_NAME asc");
		}
		return sql.toString();
	}
	
	public Object fromSQLQuery(ResultSet rs, int num) {
		SysFileCleanInfView view = new SysFileCleanInfView();
		try {

			view.setVcId(rs.getString("VC_ID"));
			view.setVcTableName(rs.getString("VC_TABLE_NAME"));
			view.setVcFileColumName(rs.getString("VC_FILE_COLUM_NAME"));
			view.setDtLastClean(rs.getDate("DT_LAST_CLEAN"));
			view.setVcUser(rs.getString("VC_USER"));			

		} catch (SQLException e) {
			
			e.printStackTrace();
		}
		return view;
	}
	
	public ISQLMapper getSQLMapper() {
		
		return this;
	}

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

}

